<?php
namespace Web\Controller;
use Think\Controller;
use Web\Controller\BaseController;
class ClientController extends BaseController {

    public function _initialize(){
        //如果session存在，传递用户信息
        $midiuser = session('midiuser');
        $this->assign('midiuser',$midiuser);
    }

    public function index(){

        $this->display();
    }

    public function download(){
    	$android_download = "http://a.app.qq.com/o/simple.jsp?pkgname=com.midi.client";
		$ios_download = "https://itunes.apple.com/cn/app/mi-di-kao-ji/id1063907388?mt=8";
    	$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
		$iphone = (strpos($agent, 'iphone')) ? true : false;
		$ipad = (strpos($agent, 'ipad')) ? true : false;
		$android = (strpos($agent, 'android')) ? true : false;
		if($iphone || $ipad)
		{
			header('Location: '.$ios_download);
		}elseif($android){
			header('Location: '.$android_download);
		}else{
			$this->display('index');
		}
    }
}